import request from '@/api/utils/requery'

//项目管理

//增加项目
export const AddProjectItem = array => {
    return request({
        method: "post",
            headers: {
              "Content-Type": "application/json",
            },
            url: "project/addProject",
            data: array,
    })
}

//项目重命名
export const RenameItem = (id,name) => {
    return request({
        method: 'post',
        url:`project/updateProjectName?projectId=${id}&&name=${name}&&editeFlag=false`
    })
}

//失去焦点
export const BlurItem = (id,name) => {
    return request({
        method: 'post',
        url:`project/updateProjectName?projectId=${id}&&name=${name}&&editeFlag=true`
    })
}

//删除项目
export const DeleteItem = id => request({
    method: 'post',
    url:`project/deleteProjectById?id=${id}`
})

//查询该项目成员
export const SearchItemUser = data => request({
    method: 'post',
    url:`project/selectUserToProject?projectId=${data}`
})

//查询已经学完的项目成员
export const SearchStudy = () => request({
    url:"project/selectStudyFinishUser"
})

//修改角色
export const EditeItemRole = (id,role) => {
    return request({
        method: 'post',
        url: `project/updateUserToProject?projectId=${id}&&str=${role}`
    })
}

//移除项目成员
export const RemoveItemRole = (item,array) => {
    return request({
        method: 'post',
        url:`project/deleteUserToProject?projectId=${item}&&arr=${array}`
    })
}

//增加项目成员
export const AddItemRole = (item,id) => {
    return request({
        method: "post",
        url:`project/addUserToProject?projectId=${item}&&arr=${id}`
    })
}